
/**
 * Created by lxh on 2017/12/6.
 */
import React, {PureComponent} from 'react';
import {Table, Alert,Select, Badge, Switch, Icon,Button, InputNumber, Tooltip, Popconfirm} from 'antd';
import styles from './index.less';
import {powerControl} from '../../utils/powerControl';
const AuthButton = powerControl(Button);
const Option = Select.Option;

export default class SystemParam extends PureComponent{
    handleTableChange = (pagination, filters, sorter) => {
        this.props.onChange(pagination, filters, sorter);
    }
    handleEdit=(record)=>{
        this.props.handleEdit(record);
    }
    render(){
        const {data: {list, pagination}, loading} = this.props;
        const columns = [
            {
                title: '参数编码',
                dataIndex: 'param_code',
                key: 'param_code',
            }, {
                title: '参数名称',
                dataIndex: 'param_name',
                key: 'param_name',
            }, {
                title: '参数类型',
                dataIndex: 'param_group_code',
                key: 'param_group_code',
            }, {
                title: '参数类型中文说明',
                dataIndex: 'param_group_text',
                key: 'param_group_text',
            }, {
                title: '参数值',
                dataIndex: 'param_value',
                key: 'param_value',
            },{
                title: '状态',
                dataIndex: 'param_status',
                key: 'param_status',
            },{
                title: '操作',
                render: (text, record) => {

                    return (
                        <Button.Group type="ghost">
                            <AuthButton auth="SystemConfig.edit" ghost  className={styles.btn} size="small" onClick={() => this.handleEdit(record)}>编辑</AuthButton>
                        </Button.Group>
                    )
                }
            }
        ];
        const paginationProps = {
            showSizeChanger: true,
            showQuickJumper: true,
            ...pagination,
        };
        return (
            <div className={styles.standardTable}>
                <Table
                    loading={loading}
                    rowKey={record => {record.parm_id,record.param_code}}
                    dataSource={list}
                    columns={columns}
                    pagination={paginationProps}
                    onChange={this.handleTableChange}
                />
            </div>
        );
    }
}